﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApp1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            treeView1.MouseLeftButtonUp += TreeView1_MouseLeftButtonUp;
        }

        private void TreeView1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TreeViewItem item = treeView1.SelectedItem as TreeViewItem;
            if (item == null) { return; }

            switch (item.Header)
            {
                case "StackPanel":
                    new StackPanelDemo1() { Owner = this }.Show();
                    break;
                case "TreeView1":
                    new TreeViewDemo1() { Owner = this }.Show();
                    break;
                case "TreeView2":
                    new TreeViewDemo2() { Owner = this }.Show();
                    break;
                case "TreeView3":
                    new TreeViewDemo3() { Owner = this }.Show();
                    break;
                case "TreeView4":
                    new TreeViewDemo4() { Owner = this }.Show();
                    break;
                case "TreeView5":
                    new TreeViewDemo5() { Owner = this }.Show();
                    break;
            }
        }
    }
}
